import { PIC_URL } from './../../providers/Config';
import { BasePage } from './../../pages/basePage';
import { UserService } from './../../providers/UserService';
import { Component, Injector,Input } from '@angular/core';
import { Events } from 'ionic-angular';

/**
 * Generated class for the ShopAllComponent component.
 *
 * See https://angular.io/api/core/Component for more info on Angular
 * Components.
 */
@Component({
  selector: 'shop-all',
  templateUrl: 'shop-all.html'
})
export class ShopAllComponent extends BasePage {
  shopList = []
  picrooturl = ''; //图片服务器的地址
  //有没有数据判断
  noInfo:boolean
  @Input() shopOrderData

  //没有数据时展示的内容
  error_msg='没有数据！';
  constructor(injector: Injector, public userService: UserService, public events: Events) {
    super(injector);
    this.picrooturl = PIC_URL;
    this.events.subscribe('shop:created', (status, id) => {
      console.log(id);
      console.log(status);
      this.shopList=[];
      if (id == 0) {
        this.shopList = status;
        if(this.shopList.length == 0){
            console.log("没有数据");
            this.noInfo=true;
        }else{
          this.noInfo=false;
        }
        return;
      }
    });
   
  
  }
  
 ionViewWillEnter(){
 }
}
